package com.tydic.daily.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * TAG 能力平台日志工具
 * 
 * TODO: 对实现进行调整，如用Log4j或者slf4j来实现等
 */
public class TapLogger {

	private static Map<String, Logger> loggerCache = new HashMap<>();

	public static Logger logger() {
		StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
		String className = stackTraceElement.getClassName();

		Logger logger = loggerCache.get(className);
		if (logger == null) {
			// 创建Logger
			logger = LoggerFactory.getLogger(className);
			loggerCache.put(className, logger);
		}
		return logger;
	}
}
